package org.finneyfill.ajax;

import java.util.ArrayList;
import java.util.List;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("serial")
public class JSONUsernamePasswordStorage extends ActionSupport {

	private List usernames = new ArrayList();
	private ArrayList dataToSend = new ArrayList();
	
	public ArrayList getDataToSend() {
		return dataToSend;
	}

	public void setDataToSend(ArrayList dataToSend) {
		this.dataToSend = dataToSend;
		System.out.println("data to send: ");
		if (dataToSend != null) {
			System.out.println("username : " + dataToSend.get(0));
			System.out.println("password : " + dataToSend.get(1));
		}
	}

	public List getUsernames() {
		return usernames;
	}

	public String execute() { 
    	usernames.add("user1 " + dataToSend.get(0));
    	usernames.add("user2 " + dataToSend.get(1));
    	return Action.SUCCESS; 
    } 
}
